﻿using HoverTree.BLL;
using HoverTree.HoverTreeFrame;
using HoverTree.Model;
using System;

namespace HoverTreeMobile.HvtAdmin.HvtPicture
{
    public partial class ImageSetAlter : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int m_id = RequestHelper.GetQueryInt("hvtid", 0);

                if (m_id < 1)
                {
                    ltlTips.Text = "图集不存在！";
                    btnSubmit.Enabled = false;
                    return;
                }

                ImageSetInfo m_info = new ImageSetInfo();
                HvtImageSet m_bll = new HvtImageSet();

                m_info = m_bll.GetByID(m_id);
                if (m_info == null)
                {
                    ltlTips.Text = "图集不存在！";
                    btnSubmit.Enabled = false;
                    return;
                }

                ltlID.Text = m_info.HvtID.ToString();
                txtTitle.Text = m_info.HvtTitle;
                txtLink.Text = m_info.HvtLink;
                cbIsShow.Checked = m_info.HvtisShow;
                cbIsTop.Checked = m_info.HvtIsTop;
            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ImageSetInfo m_info = new ImageSetInfo();
            HvtImageSet m_bll = new HvtImageSet();

            m_info.HvtID = Convert.ToInt32(ltlID.Text);
            m_info.HvtTitle = txtTitle.Text;
            m_info.HvtLink = txtLink.Text;
            m_info.HvtisShow = cbIsShow.Checked;
            m_info.HvtIsTop = cbIsTop.Checked;

         ltlTips.Text=   m_bll.Alter(m_info);
            if (ltlTips.Text == string.Empty)
                ltlTips.Text = "修改成功";
        }
    }
}